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

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

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

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

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

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

e.o = a
e.p = a
c.z = k
c.p = i
c.q = i
c.r = a
c.u = a
g.y = b
a.p = i
a.y = i
a.x = l
a.o = c
a.r = g
l.v = e
l.x = c
h.v = e
h.x = c
i.o = a
i.p = a
k.y = g
b.y = k
assert k.y.y.y.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.p: D = None
        self.txt = txt

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

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

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

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

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

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