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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: G = None
        self.p: A = None
        self.r: G = None
        self.u: E = None
        self.w: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: G = None
        self.t: D = None
        self.x: B = None
        self.z: D = None
        self.y: D = None
        self.r: G = None
        self.p: D = None
        self.txt = txt

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

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

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

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

i = A("i")
a = B("a")
d = C("d")
c = D("c")
m = E("m")
l = F("l")
h = G("h")

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

class B:
    def __init__(self, txt: str):
        self.z: E = None
        self.y: G = None
        self.p: A = None
        self.r: G = None
        self.u: E = None
        self.w: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: G = None
        self.t: D = None
        self.x: B = None
        self.z: D = None
        self.y: D = None
        self.r: G = None
        self.p: D = None
        self.txt = txt

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

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

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

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

i = A("i")
a = B("a")
d = C("d")
c = D("c")
m = E("m")
l = F("l")
h = G("h")

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