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

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

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

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

j = A("j")
b = B("b")
l = C("l")
e = D("e")
f = A("f")
n = C("n")
m = D("m")
g = C("g")
d = A("d")

j.t = b
b.r = j
b.t = m
l.v = b
l.u = j
l.t = m
e.w = b
e.y = l
f.t = b
n.v = b
n.u = j
n.t = m
m.w = b
m.y = g
g.v = b
g.u = f
g.t = e
d.t = b
assert j.t.r.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

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

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

j = A("j")
b = B("b")
l = C("l")
e = D("e")
f = A("f")
n = C("n")
m = D("m")
g = C("g")
d = A("d")

j.t = b
b.r = j
b.t = m
l.v = b
l.u = j
l.t = m
e.w = b
e.y = l
f.t = b
n.v = b
n.u = j
n.t = m
m.w = b
m.y = g
g.v = b
g.u = f
g.t = e
d.t = b
assert j.t.r.t.txt == "b"