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

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

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

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

j = A("j")
a = B("a")
n = C("n")
m = D("m")
f = D("f")
c = B("c")
g = B("g")
e = D("e")
i = C("i")

j.t = m
a.o = m
a.r = j
a.s = j
n.y = i
n.q = m
n.v = m
n.x = f
m.r = i
m.t = j
m.u = n
f.r = n
f.t = j
f.u = i
c.o = f
c.r = j
c.s = j
g.o = f
g.r = j
g.s = j
e.r = i
e.t = j
e.u = n
i.y = n
i.q = f
i.v = f
i.x = e
assert i.v.u.v.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

j = A("j")
a = B("a")
n = C("n")
m = D("m")
f = D("f")
c = B("c")
g = B("g")
e = D("e")
i = C("i")

j.t = m
a.o = m
a.r = j
a.s = j
n.y = i
n.q = m
n.v = m
n.x = f
m.r = i
m.t = j
m.u = n
f.r = n
f.t = j
f.u = i
c.o = f
c.r = j
c.s = j
g.o = f
g.r = j
g.s = j
e.r = i
e.t = j
e.u = n
i.y = n
i.q = f
i.v = f
i.x = e
assert i.v.u.v.r.y.txt == "i"