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

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: A = None
        self.r: A = None
        self.txt = txt

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

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

b = A("b")
m = B("m")
h = C("h")
l = D("l")
a = D("a")

b.x = h
b.y = l
b.s = a
b.t = a
m.w = h
m.p = b
m.r = b
h.s = m
h.q = m
h.v = a
l.u = a
a.u = l
assert h.v.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.y: D = None
        self.s: D = None
        self.t: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: C = None
        self.p: A = None
        self.r: A = None
        self.txt = txt

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

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

b = A("b")
m = B("m")
h = C("h")
l = D("l")
a = D("a")

b.x = h
b.y = l
b.s = a
b.t = a
m.w = h
m.p = b
m.r = b
h.s = m
h.q = m
h.v = a
l.u = a
a.u = l
assert h.v.u.u.u.txt == "l"