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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: D = None
        self.v: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.r: D = None
        self.y: E = None
        self.v: E = None
        self.s: A = None
        self.txt = txt

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

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

d = A("d")
k = B("k")
m = C("m")
c = D("c")
b = E("b")
n = D("n")

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

class B:
    def __init__(self, txt: str):
        self.q: E = None
        self.z: D = None
        self.v: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.p: A = None
        self.r: D = None
        self.y: E = None
        self.v: E = None
        self.s: A = None
        self.txt = txt

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

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

d = A("d")
k = B("k")
m = C("m")
c = D("c")
b = E("b")
n = D("n")

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