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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: D = None
        self.z: B = None
        self.q: C = None
        self.txt = txt

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

h.p = d
h.r = k
h.o = g
h.u = j
j.o = i
j.p = a
b.y = e
e.t = i
i.o = d
i.t = e
i.z = j
i.q = b
d.y = e
a.o = i
a.p = j
k.p = d
k.r = h
k.o = a
k.u = g
g.o = i
g.p = j
assert g.p.p.o.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: A = None
        self.o: B = None
        self.u: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: D = None
        self.z: B = None
        self.q: C = None
        self.txt = txt

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

h.p = d
h.r = k
h.o = g
h.u = j
j.o = i
j.p = a
b.y = e
e.t = i
i.o = d
i.t = e
i.z = j
i.q = b
d.y = e
a.o = i
a.p = j
k.p = d
k.r = h
k.o = a
k.u = g
g.o = i
g.p = j
assert g.p.p.o.o.txt == "d"