class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: C = None
        self.r: F = None
        self.o: F = None
        self.w: D = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: B = None
        self.q: B = None
        self.t: D = None
        self.p: A = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: C = None
        self.r: F = None
        self.o: F = None
        self.w: D = None
        self.x: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.q: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.s: E = None
        self.x: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: D = None
        self.r: B = None
        self.q: B = None
        self.t: D = None
        self.p: A = None
        self.txt = txt

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

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