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

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

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

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

m = A("m")
c = B("c")
e = C("e")
f = D("f")
b = B("b")
n = B("n")
g = A("g")
a = A("a")
l = C("l")

m.y = a
m.v = f
m.t = l
c.t = e
e.z = g
e.q = g
e.p = g
e.u = f
f.w = m
f.q = b
f.p = l
f.u = g
b.t = l
n.t = e
g.y = m
g.v = f
g.t = l
a.y = g
a.v = f
a.t = l
l.z = a
l.p = a
l.q = g
l.u = f
assert g.t.u.q.t.q.v.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.v: D = None
        self.t: C = None
        self.txt = txt

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

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

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

m = A("m")
c = B("c")
e = C("e")
f = D("f")
b = B("b")
n = B("n")
g = A("g")
a = A("a")
l = C("l")

m.y = a
m.v = f
m.t = l
c.t = e
e.z = g
e.q = g
e.p = g
e.u = f
f.w = m
f.q = b
f.p = l
f.u = g
b.t = l
n.t = e
g.y = m
g.v = f
g.t = l
a.y = g
a.v = f
a.t = l
l.z = a
l.p = a
l.q = g
l.u = f
assert g.t.u.q.t.q.v.txt == "f"