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

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: A = None
        self.w: F = None
        self.v: A = None
        self.q: D = None
        self.z: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: F = None
        self.r: G = None
        self.txt = txt

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

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

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

c = A("c")
m = B("m")
d = C("d")
i = D("i")
n = E("n")
k = F("k")
f = G("f")

c.u = d
m.t = c
m.r = c
m.v = c
m.w = k
m.z = k
m.q = i
d.v = k
i.p = d
i.o = k
i.r = f
n.z = k
k.q = c
k.t = i
k.y = i
f.v = n
assert i.o.q.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: A = None
        self.w: F = None
        self.v: A = None
        self.q: D = None
        self.z: F = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.o: F = None
        self.r: G = None
        self.txt = txt

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

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

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

c = A("c")
m = B("m")
d = C("d")
i = D("i")
n = E("n")
k = F("k")
f = G("f")

c.u = d
m.t = c
m.r = c
m.v = c
m.w = k
m.z = k
m.q = i
d.v = k
i.p = d
i.o = k
i.r = f
n.z = k
k.q = c
k.t = i
k.y = i
f.v = n
assert i.o.q.u.v.txt == "k"