class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: E = None
        self.w: A = None
        self.r: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: F = None
        self.p: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.x: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: D = None
        self.txt = txt

d = A("d")
n = B("n")
c = C("c")
f = D("f")
b = E("b")
l = F("l")
a = A("a")
e = B("e")
i = E("i")
m = B("m")

d.o = c
n.p = m
n.t = i
n.w = d
n.r = f
c.y = l
f.x = c
f.q = l
f.p = l
b.y = a
b.x = c
l.t = c
l.z = f
a.o = c
e.p = n
e.t = i
e.w = d
e.r = f
i.y = d
i.x = c
m.p = e
m.t = b
m.w = d
m.r = f
assert n.r.p.t.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: E = None
        self.w: A = None
        self.r: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.x: C = None
        self.q: F = None
        self.p: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.x: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.t: C = None
        self.z: D = None
        self.txt = txt

d = A("d")
n = B("n")
c = C("c")
f = D("f")
b = E("b")
l = F("l")
a = A("a")
e = B("e")
i = E("i")
m = B("m")

d.o = c
n.p = m
n.t = i
n.w = d
n.r = f
c.y = l
f.x = c
f.q = l
f.p = l
b.y = a
b.x = c
l.t = c
l.z = f
a.o = c
e.p = n
e.t = i
e.w = d
e.r = f
i.y = d
i.x = c
m.p = e
m.t = b
m.w = d
m.r = f
assert n.r.p.t.y.txt == "l"