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

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

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.p: F = None
        self.t: E = None
        self.z: C = None
        self.txt = txt

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

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

j = A("j")
e = B("e")
b = C("b")
g = D("g")
a = E("a")
i = F("i")
c = F("c")
m = C("m")
h = F("h")

j.u = c
j.z = e
e.y = a
b.v = m
g.v = a
g.t = a
g.p = c
g.z = b
a.y = g
a.z = g
i.q = j
c.q = j
m.v = b
h.q = j
assert g.z.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.z: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: E = None
        self.p: F = None
        self.t: E = None
        self.z: C = None
        self.txt = txt

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

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

j = A("j")
e = B("e")
b = C("b")
g = D("g")
a = E("a")
i = F("i")
c = F("c")
m = C("m")
h = F("h")

j.u = c
j.z = e
e.y = a
b.v = m
g.v = a
g.t = a
g.p = c
g.z = b
a.y = g
a.z = g
i.q = j
c.q = j
m.v = b
h.q = j
assert g.z.v.v.v.txt == "m"