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

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.w: E = None
        self.r: F = None
        self.s: G = None
        self.u: B = None
        self.z: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: D = None
        self.v: B = None
        self.u: E = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.x: E = None
        self.w: E = None
        self.r: F = None
        self.s: G = None
        self.u: B = None
        self.z: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.r: C = None
        self.o: D = None
        self.v: B = None
        self.u: E = None
        self.txt = txt

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

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