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: A = None
        self.o: D = None
        self.r: F = None
        self.u: C = None
        self.txt = txt

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

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

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

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

b = A("b")
n = B("n")
c = C("c")
m = D("m")
h = E("h")
a = F("a")
j = F("j")
i = E("i")

b.p = m
n.x = m
n.o = m
n.q = b
n.r = j
n.u = c
c.z = j
m.t = j
h.v = c
a.o = c
j.o = c
i.v = c
assert a.o.z.o.z.o.z.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: A = None
        self.o: D = None
        self.r: F = None
        self.u: C = None
        self.txt = txt

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

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

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

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

b = A("b")
n = B("n")
c = C("c")
m = D("m")
h = E("h")
a = F("a")
j = F("j")
i = E("i")

b.p = m
n.x = m
n.o = m
n.q = b
n.r = j
n.u = c
c.z = j
m.t = j
h.v = c
a.o = c
j.o = c
i.v = c
assert a.o.z.o.z.o.z.txt == "j"