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

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: C = None
        self.y: C = None
        self.s: B = None
        self.txt = txt

e = A("e")
c = B("c")
i = C("i")
j = D("j")
m = D("m")

e.u = i
e.r = i
c.x = m
c.o = e
i.t = e
i.p = e
i.r = e
i.u = c
j.z = i
j.q = i
j.y = i
j.s = c
m.z = i
m.q = i
m.y = i
m.s = c
assert c.x.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.r: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.q: C = None
        self.y: C = None
        self.s: B = None
        self.txt = txt

e = A("e")
c = B("c")
i = C("i")
j = D("j")
m = D("m")

e.u = i
e.r = i
c.x = m
c.o = e
i.t = e
i.p = e
i.r = e
i.u = c
j.z = i
j.q = i
j.y = i
j.s = c
m.z = i
m.q = i
m.y = i
m.s = c
assert c.x.q.p.txt == "e"