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

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

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

class D:
    def __init__(self, txt: str):
        self.r: G = None
        self.w: A = None
        self.t: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: A = None
        self.txt = txt

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

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

h = A("h")
l = B("l")
j = C("j")
b = D("b")
m = E("m")
f = F("f")
g = G("g")
a = E("a")
c = C("c")

h.w = a
h.r = f
h.s = f
h.q = m
l.r = h
j.q = l
j.v = g
j.x = h
b.r = g
b.w = h
b.t = a
m.o = a
m.r = h
f.t = l
f.s = a
f.q = a
f.x = b
g.w = c
g.z = c
g.t = h
g.v = h
g.x = a
g.p = b
a.o = m
a.r = h
c.q = l
c.v = g
c.x = h
assert b.r.p.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.r: F = None
        self.q: E = None
        self.s: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.r: G = None
        self.w: A = None
        self.t: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.o: E = None
        self.r: A = None
        self.txt = txt

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

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

h = A("h")
l = B("l")
j = C("j")
b = D("b")
m = E("m")
f = F("f")
g = G("g")
a = E("a")
c = C("c")

h.w = a
h.r = f
h.s = f
h.q = m
l.r = h
j.q = l
j.v = g
j.x = h
b.r = g
b.w = h
b.t = a
m.o = a
m.r = h
f.t = l
f.s = a
f.q = a
f.x = b
g.w = c
g.z = c
g.t = h
g.v = h
g.x = a
g.p = b
a.o = m
a.r = h
c.q = l
c.v = g
c.x = h
assert b.r.p.t.txt == "a"