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

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

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

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

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

g.r = b
n.o = j
n.u = e
j.y = k
b.p = k
b.q = n
b.y = i
i.p = j
i.q = n
i.y = b
k.y = j
l.r = b
e.o = k
e.u = n
assert k.y.y.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

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

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

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

g.r = b
n.o = j
n.u = e
j.y = k
b.p = k
b.q = n
b.y = i
i.p = j
i.q = n
i.y = b
k.y = j
l.r = b
e.o = k
e.u = n
assert k.y.y.y.y.txt == "k"