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

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.t: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: F = None
        self.p: A = None
        self.t: E = None
        self.s: A = None
        self.w: B = None
        self.u: F = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.x: F = None
        self.t: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: C = None
        self.x: F = None
        self.p: A = None
        self.t: E = None
        self.s: A = None
        self.w: B = None
        self.u: F = None
        self.txt = txt

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

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