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

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: D = None
        self.u: C = None
        self.txt = txt

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

i = A("i")
g = B("g")
j = C("j")
l = D("l")
c = B("c")
a = D("a")
k = C("k")
n = D("n")
h = A("h")
b = A("b")

i.o = c
i.r = c
i.y = j
g.u = j
g.p = h
j.v = k
j.u = k
j.z = n
l.y = a
c.u = j
c.p = b
a.y = n
k.v = j
k.u = j
k.z = a
n.y = l
h.o = g
h.y = j
h.r = c
b.o = g
b.y = k
b.r = c
assert g.u.z.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: C = None
        self.r: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: D = None
        self.u: C = None
        self.txt = txt

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

i = A("i")
g = B("g")
j = C("j")
l = D("l")
c = B("c")
a = D("a")
k = C("k")
n = D("n")
h = A("h")
b = A("b")

i.o = c
i.r = c
i.y = j
g.u = j
g.p = h
j.v = k
j.u = k
j.z = n
l.y = a
c.u = j
c.p = b
a.y = n
k.v = j
k.u = j
k.z = a
n.y = l
h.o = g
h.y = j
h.r = c
b.o = g
b.y = k
b.r = c
assert g.u.z.y.y.y.y.y.y.txt == "n"