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

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: A = None
        self.q: C = None
        self.y: B = None
        self.txt = txt

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

e.y = h
e.r = d
e.u = d
a.z = l
a.t = b
j.s = l
j.q = b
j.x = e
h.p = b
h.t = e
h.q = d
h.y = f
l.s = d
l.q = a
l.x = g
b.z = l
b.t = f
f.z = j
f.t = b
d.s = l
d.q = a
d.x = g
g.y = h
g.r = d
g.u = j
assert e.y.t.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: C = None
        self.u: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: B = None
        self.t: A = None
        self.q: C = None
        self.y: B = None
        self.txt = txt

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

e.y = h
e.r = d
e.u = d
a.z = l
a.t = b
j.s = l
j.q = b
j.x = e
h.p = b
h.t = e
h.q = d
h.y = f
l.s = d
l.q = a
l.x = g
b.z = l
b.t = f
f.z = j
f.t = b
d.s = l
d.q = a
d.x = g
g.y = h
g.r = d
g.u = j
assert e.y.t.r.txt == "d"