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

class B:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: D = None
        self.r: B = None
        self.txt = txt

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

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

d = A("d")
b = B("b")
c = C("c")
n = D("n")
j = B("j")
i = A("i")
e = D("e")

d.u = e
b.v = j
b.r = j
b.p = n
c.t = e
c.p = e
c.o = d
c.u = d
n.w = i
n.y = i
n.q = e
j.v = b
j.r = b
j.p = n
i.u = e
e.w = i
e.y = d
e.q = n
assert c.u.u.w.u.q.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: D = None
        self.r: B = None
        self.txt = txt

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

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

d = A("d")
b = B("b")
c = C("c")
n = D("n")
j = B("j")
i = A("i")
e = D("e")

d.u = e
b.v = j
b.r = j
b.p = n
c.t = e
c.p = e
c.o = d
c.u = d
n.w = i
n.y = i
n.q = e
j.v = b
j.r = b
j.p = n
i.u = e
e.w = i
e.y = d
e.q = n
assert c.u.u.w.u.q.y.u.txt == "e"