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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

n.p = d
n.s = l
c.t = n
c.r = b
c.u = b
c.z = l
c.x = j
c.y = d
k.p = n
k.u = b
k.z = m
d.v = b
j.v = l
j.p = n
m.t = j
m.s = n
b.y = c
b.r = c
b.x = k
b.o = l
b.s = n
b.w = n
b.p = m
l.t = n
l.r = b
l.u = b
l.z = c
l.x = j
l.y = d
assert d.v.w.p.txt == "d"