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

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

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

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

f = A("f")
k = B("k")
n = C("n")
e = D("e")
b = B("b")
a = D("a")
g = B("g")
m = C("m")

f.t = a
f.v = b
k.y = a
k.s = a
n.x = b
e.x = a
b.y = a
b.s = e
a.x = e
g.y = a
g.s = a
m.x = b
assert b.s.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.v: B = None
        self.txt = txt

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

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

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

f = A("f")
k = B("k")
n = C("n")
e = D("e")
b = B("b")
a = D("a")
g = B("g")
m = C("m")

f.t = a
f.v = b
k.y = a
k.s = a
n.x = b
e.x = a
b.y = a
b.s = e
a.x = e
g.y = a
g.s = a
m.x = b
assert b.s.x.x.x.x.txt == "e"