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

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: F = None
        self.r: E = None
        self.p: F = None
        self.t: F = None
        self.q: G = None
        self.x: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: G = None
        self.y: E = None
        self.p: A = None
        self.t: A = None
        self.z: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

l.p = g
l.q = m
l.r = a
b.v = d
b.r = g
c.u = j
c.v = d
c.p = d
c.t = d
c.x = d
c.r = g
c.q = a
m.y = c
m.v = c
g.z = j
g.s = l
g.q = l
g.x = l
g.r = b
g.p = f
d.v = a
d.y = f
d.p = l
d.t = l
d.z = l
a.x = m
j.v = d
j.r = f
f.z = j
f.r = j
f.s = l
f.q = l
f.x = l
f.p = g
assert c.q.x.y.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.q: D = None
        self.r: G = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.v: F = None
        self.r: E = None
        self.p: F = None
        self.t: F = None
        self.q: G = None
        self.x: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.v: G = None
        self.y: E = None
        self.p: A = None
        self.t: A = None
        self.z: A = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.x: D = None
        self.txt = txt

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

l.p = g
l.q = m
l.r = a
b.v = d
b.r = g
c.u = j
c.v = d
c.p = d
c.t = d
c.x = d
c.r = g
c.q = a
m.y = c
m.v = c
g.z = j
g.s = l
g.q = l
g.x = l
g.r = b
g.p = f
d.v = a
d.y = f
d.p = l
d.t = l
d.z = l
a.x = m
j.v = d
j.r = f
f.z = j
f.r = j
f.s = l
f.q = l
f.x = l
f.p = g
assert c.q.x.y.r.txt == "g"