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

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: D = None
        self.s: E = None
        self.t: E = None
        self.v: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.z: A = None
        self.txt = txt

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

j = A("j")
n = B("n")
d = C("d")
i = D("i")
f = E("f")
b = F("b")

j.q = f
j.t = d
n.o = b
n.q = d
d.z = i
d.u = i
d.s = f
d.t = f
d.v = n
i.o = b
i.y = j
i.x = j
i.p = d
f.p = b
f.z = j
b.u = i
b.p = n
b.x = j
assert f.z.q.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.t: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: D = None
        self.u: D = None
        self.s: E = None
        self.t: E = None
        self.v: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.p: F = None
        self.z: A = None
        self.txt = txt

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

j = A("j")
n = B("n")
d = C("d")
i = D("i")
f = E("f")
b = F("b")

j.q = f
j.t = d
n.o = b
n.q = d
d.z = i
d.u = i
d.s = f
d.t = f
d.v = n
i.o = b
i.y = j
i.x = j
i.p = d
f.p = b
f.z = j
b.u = i
b.p = n
b.x = j
assert f.z.q.p.u.txt == "i"