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

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

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

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

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

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

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

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

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

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

b.q = g
b.z = f
b.u = l
b.p = j
f.v = n
l.y = d
n.z = d
n.t = b
n.r = a
n.u = f
d.y = l
a.z = d
a.t = b
a.r = n
a.u = f
g.y = d
j.q = d
j.z = f
j.u = g
j.p = b
h.z = l
h.t = j
h.r = m
h.u = f
m.z = l
m.t = j
m.r = a
m.u = f
assert f.v.t.p.z.v.t.txt == "b"