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

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

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

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

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

l.t = j
l.x = j
g.v = n
g.r = e
h.w = n
h.s = e
e.t = n
j.t = l
c.w = l
c.s = j
a.w = n
a.s = e
d.w = l
d.s = e
n.t = j
n.x = j
assert l.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.x: D = None
        self.txt = txt

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

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

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

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

l.t = j
l.x = j
g.v = n
g.r = e
h.w = n
h.s = e
e.t = n
j.t = l
c.w = l
c.s = j
a.w = n
a.s = e
d.w = l
d.s = e
n.t = j
n.x = j
assert l.t.t.t.t.txt == "l"