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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: C = 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.v: C = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.s: A = None
        self.p: C = 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.v: C = None
        self.txt = txt

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

e.u = j
l.s = e
l.p = c
j.y = k
k.v = c
n.y = k
c.y = k
a.u = n
g.u = j
assert c.y.v.y.v.y.v.y.txt == "k"