class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.q: E = None
        self.x: A = None
        self.u: C = None
        self.txt = txt

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

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

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

b.p = d
c.x = d
c.q = l
f.x = l
d.t = b
d.x = b
d.q = n
d.u = f
n.u = d
n.z = d
n.t = d
n.p = d
n.r = b
l.w = c
l.q = b
l.x = n
l.v = d
l.r = d
l.o = f
assert c.x.q.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.q: E = None
        self.x: A = None
        self.u: C = None
        self.txt = txt

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

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

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

b.p = d
c.x = d
c.q = l
f.x = l
d.t = b
d.x = b
d.q = n
d.u = f
n.u = d
n.z = d
n.t = d
n.p = d
n.r = b
l.w = c
l.q = b
l.x = n
l.v = d
l.r = d
l.o = f
assert c.x.q.u.u.txt == "f"