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

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

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

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

j = A("j")
g = B("g")
b = C("b")
m = D("m")
l = D("l")
h = D("h")
k = C("k")

j.v = g
j.x = m
j.s = b
g.o = k
g.y = l
b.u = k
m.r = l
m.u = j
m.q = j
l.r = m
l.u = j
l.q = j
h.r = l
h.u = j
h.q = j
k.u = b
assert h.r.r.q.s.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.x: D = None
        self.s: C = None
        self.txt = txt

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

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

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

j = A("j")
g = B("g")
b = C("b")
m = D("m")
l = D("l")
h = D("h")
k = C("k")

j.v = g
j.x = m
j.s = b
g.o = k
g.y = l
b.u = k
m.r = l
m.u = j
m.q = j
l.r = m
l.u = j
l.q = j
h.r = l
h.u = j
h.q = j
k.u = b
assert h.r.r.q.s.u.u.txt == "b"