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

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

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

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

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

e.p = d
e.t = j
k.p = e
k.v = m
k.u = j
j.s = g
d.y = e
d.u = k
f.p = a
f.v = m
f.u = j
a.p = d
a.t = j
i.p = d
i.t = j
b.y = e
b.u = m
g.p = b
g.t = j
m.p = i
m.v = f
m.u = j
assert i.p.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.t: C = None
        self.txt = txt

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

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

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

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

e.p = d
e.t = j
k.p = e
k.v = m
k.u = j
j.s = g
d.y = e
d.u = k
f.p = a
f.v = m
f.u = j
a.p = d
a.t = j
i.p = d
i.t = j
b.y = e
b.u = m
g.p = b
g.t = j
m.p = i
m.v = f
m.u = j
assert i.p.u.p.txt == "e"