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

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.v: A = None
        self.txt = txt

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

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

n = A("n")
k = B("k")
h = C("h")
i = D("i")
c = E("c")
b = F("b")
d = E("d")

n.q = k
n.o = k
n.p = k
n.y = h
k.x = n
k.o = c
h.u = k
h.t = k
i.w = c
i.v = n
c.z = i
c.q = i
c.o = n
c.t = b
c.x = k
c.p = k
b.r = i
b.z = i
b.u = n
d.z = i
d.q = i
d.o = n
d.t = b
d.x = k
d.p = k
assert h.u.x.o.o.p.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.y: C = None
        self.o: B = None
        self.p: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.w: E = None
        self.v: A = None
        self.txt = txt

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

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

n = A("n")
k = B("k")
h = C("h")
i = D("i")
c = E("c")
b = F("b")
d = E("d")

n.q = k
n.o = k
n.p = k
n.y = h
k.x = n
k.o = c
h.u = k
h.t = k
i.w = c
i.v = n
c.z = i
c.q = i
c.o = n
c.t = b
c.x = k
c.p = k
b.r = i
b.z = i
b.u = n
d.z = i
d.q = i
d.o = n
d.t = b
d.x = k
d.p = k
assert h.u.x.o.o.p.x.o.txt == "k"