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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

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

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