class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: G = None
        self.y: C = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.y: F = None
        self.s: B = None
        self.r: A = None
        self.z: C = None
        self.q: A = None
        self.u: F = None
        self.o: F = None
        self.txt = txt

l = A("l")
m = B("m")
a = C("a")
e = D("e")
g = E("g")
n = F("n")
c = G("c")
k = B("k")
f = C("f")
j = F("j")

l.p = f
l.r = c
l.y = a
l.x = g
m.u = k
m.w = c
m.p = j
m.y = l
a.p = j
a.o = c
e.x = n
g.z = c
g.p = c
g.x = n
n.s = g
c.y = j
c.s = k
c.r = l
c.q = l
c.z = a
c.u = n
c.o = n
k.u = m
k.w = c
k.p = n
k.y = l
f.p = n
f.o = c
j.s = g
assert m.w.q.y.p.s.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: G = None
        self.y: C = None
        self.x: E = None
        self.txt = txt

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

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

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

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

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

class G:
    def __init__(self, txt: str):
        self.y: F = None
        self.s: B = None
        self.r: A = None
        self.z: C = None
        self.q: A = None
        self.u: F = None
        self.o: F = None
        self.txt = txt

l = A("l")
m = B("m")
a = C("a")
e = D("e")
g = E("g")
n = F("n")
c = G("c")
k = B("k")
f = C("f")
j = F("j")

l.p = f
l.r = c
l.y = a
l.x = g
m.u = k
m.w = c
m.p = j
m.y = l
a.p = j
a.o = c
e.x = n
g.z = c
g.p = c
g.x = n
n.s = g
c.y = j
c.s = k
c.r = l
c.q = l
c.z = a
c.u = n
c.o = n
k.u = m
k.w = c
k.p = n
k.y = l
f.p = n
f.o = c
j.s = g
assert m.w.q.y.p.s.x.s.txt == "g"