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

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

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

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

j = A("j")
m = B("m")
d = C("d")
g = D("g")
a = C("a")
l = C("l")
n = D("n")
b = D("b")
e = A("e")

j.t = d
j.r = d
j.y = b
m.v = j
m.w = b
m.q = e
m.u = n
d.q = b
g.q = m
g.z = a
g.o = l
a.q = g
l.q = g
n.q = m
n.z = l
n.o = a
b.q = m
b.z = a
b.o = a
e.t = a
e.r = d
e.y = n
assert e.y.q.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.r: C = None
        self.y: D = None
        self.txt = txt

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

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

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

j = A("j")
m = B("m")
d = C("d")
g = D("g")
a = C("a")
l = C("l")
n = D("n")
b = D("b")
e = A("e")

j.t = d
j.r = d
j.y = b
m.v = j
m.w = b
m.q = e
m.u = n
d.q = b
g.q = m
g.z = a
g.o = l
a.q = g
l.q = g
n.q = m
n.z = l
n.o = a
b.q = m
b.z = a
b.o = a
e.t = a
e.r = d
e.y = n
assert e.y.q.q.txt == "e"