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

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

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

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

j = A("j")
c = B("c")
l = C("l")
d = D("d")
k = C("k")
h = A("h")
i = B("i")
a = D("a")

j.t = a
c.v = h
l.u = h
l.r = d
l.v = k
d.y = h
k.u = j
k.r = d
k.v = l
h.t = a
i.v = j
a.y = h
assert j.t.y.t.y.t.y.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

j = A("j")
c = B("c")
l = C("l")
d = D("d")
k = C("k")
h = A("h")
i = B("i")
a = D("a")

j.t = a
c.v = h
l.u = h
l.r = d
l.v = k
d.y = h
k.u = j
k.r = d
k.v = l
h.t = a
i.v = j
a.y = h
assert j.t.y.t.y.t.y.t.txt == "a"