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

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

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

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

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

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

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

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

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

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

n.v = b
e.z = c
e.u = a
e.v = f
b.t = e
b.w = n
b.s = n
b.z = f
c.u = a
c.q = n
c.t = n
f.u = e
f.q = n
f.t = n
a.z = f
a.u = e
a.v = c
assert a.z.q.v.t.z.txt == "c"