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

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: D = None
        self.o: F = None
        self.z: A = None
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

f = A("f")
g = B("g")
k = C("k")
i = D("i")
b = E("b")
d = F("d")
a = D("a")
e = C("e")
m = C("m")
n = E("n")

f.v = g
f.r = k
g.q = f
k.u = g
k.t = m
i.s = g
i.p = a
i.o = d
i.z = f
i.x = f
b.o = n
d.y = m
a.s = g
a.p = i
a.o = d
a.z = f
a.x = f
e.u = g
e.t = m
m.u = g
m.t = k
n.o = b
assert d.y.t.u.q.v.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: B = None
        self.r: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.s: B = None
        self.p: D = None
        self.o: F = None
        self.z: A = None
        self.x: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: E = None
        self.txt = txt

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

f = A("f")
g = B("g")
k = C("k")
i = D("i")
b = E("b")
d = F("d")
a = D("a")
e = C("e")
m = C("m")
n = E("n")

f.v = g
f.r = k
g.q = f
k.u = g
k.t = m
i.s = g
i.p = a
i.o = d
i.z = f
i.x = f
b.o = n
d.y = m
a.s = g
a.p = i
a.o = d
a.z = f
a.x = f
e.u = g
e.t = m
m.u = g
m.t = k
n.o = b
assert d.y.t.u.q.v.q.txt == "f"