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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: E = None
        self.w: E = None
        self.txt = txt

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

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

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

g = A("g")
a = B("a")
l = C("l")
k = D("k")
j = E("j")
i = A("i")
c = C("c")

g.p = a
a.z = j
a.u = j
a.w = j
l.t = g
l.y = g
l.s = i
l.r = c
k.y = j
j.o = k
j.p = g
j.u = l
i.p = a
c.t = g
c.y = g
c.s = i
c.r = l
assert j.u.y.p.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.u: E = None
        self.w: E = None
        self.txt = txt

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

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

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

g = A("g")
a = B("a")
l = C("l")
k = D("k")
j = E("j")
i = A("i")
c = C("c")

g.p = a
a.z = j
a.u = j
a.w = j
l.t = g
l.y = g
l.s = i
l.r = c
k.y = j
j.o = k
j.p = g
j.u = l
i.p = a
c.t = g
c.y = g
c.s = i
c.r = l
assert j.u.y.p.u.p.txt == "g"