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

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: C = None
        self.o: B = None
        self.txt = txt

b = A("b")
n = B("n")
e = C("e")
k = D("k")
h = A("h")
d = D("d")
i = A("i")

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

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

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.w: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: A = None
        self.z: C = None
        self.o: B = None
        self.txt = txt

b = A("b")
n = B("n")
e = C("e")
k = D("k")
h = A("h")
d = D("d")
i = A("i")

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