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

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: B = None
        self.s: B = None
        self.z: A = None
        self.txt = txt

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

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

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

g.y = h
n.t = e
n.r = h
n.y = a
h.w = c
h.p = a
h.s = a
h.z = g
c.o = b
c.r = e
j.p = b
j.q = h
b.o = c
b.r = g
a.t = e
a.r = h
a.y = n
e.y = h
l.y = h
assert a.y.t.y.z.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: D = None
        self.p: B = None
        self.s: B = None
        self.z: A = None
        self.txt = txt

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

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

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

g.y = h
n.t = e
n.r = h
n.y = a
h.w = c
h.p = a
h.s = a
h.z = g
c.o = b
c.r = e
j.p = b
j.q = h
b.o = c
b.r = g
a.t = e
a.r = h
a.y = n
e.y = h
l.y = h
assert a.y.t.y.z.y.txt == "h"