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

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

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

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

d = A("d")
a = B("a")
e = C("e")
l = D("l")
m = C("m")
h = B("h")
g = D("g")
j = A("j")
b = C("b")

d.s = a
d.t = g
a.u = m
a.w = j
e.z = j
e.r = l
e.x = g
l.t = b
m.z = d
m.r = l
m.x = g
h.u = e
h.w = d
g.t = e
j.s = a
j.t = g
b.z = j
b.r = g
b.x = l
assert b.r.t.r.t.x.t.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.s: B = None
        self.t: D = None
        self.txt = txt

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

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

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

d = A("d")
a = B("a")
e = C("e")
l = D("l")
m = C("m")
h = B("h")
g = D("g")
j = A("j")
b = C("b")

d.s = a
d.t = g
a.u = m
a.w = j
e.z = j
e.r = l
e.x = g
l.t = b
m.z = d
m.r = l
m.x = g
h.u = e
h.w = d
g.t = e
j.s = a
j.t = g
b.z = j
b.r = g
b.x = l
assert b.r.t.r.t.x.t.x.t.txt == "b"