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

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

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

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

e = A("e")
d = B("d")
k = C("k")
j = D("j")
c = C("c")
i = C("i")
n = B("n")
g = C("g")
l = C("l")

e.r = c
e.p = i
d.t = n
d.u = i
k.t = n
k.x = d
j.s = k
j.y = i
j.p = e
c.t = d
c.x = n
i.t = n
i.x = d
n.t = d
n.u = k
g.t = d
g.x = n
l.t = n
l.x = d
assert i.x.u.t.u.x.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.p: C = None
        self.txt = txt

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

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

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

e = A("e")
d = B("d")
k = C("k")
j = D("j")
c = C("c")
i = C("i")
n = B("n")
g = C("g")
l = C("l")

e.r = c
e.p = i
d.t = n
d.u = i
k.t = n
k.x = d
j.s = k
j.y = i
j.p = e
c.t = d
c.x = n
i.t = n
i.x = d
n.t = d
n.u = k
g.t = d
g.x = n
l.t = n
l.x = d
assert i.x.u.t.u.x.u.txt == "i"