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

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

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

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

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

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

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

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

l.p = c
l.u = a
b.o = l
b.v = a
b.x = a
b.y = c
a.u = f
a.o = c
a.v = c
a.q = l
a.r = l
a.z = b
a.s = b
m.p = h
h.v = f
f.p = b
f.z = h
c.v = a
c.z = b
assert f.p.y.v.z.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.u: C = None
        self.txt = txt

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

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

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

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

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

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

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

l.p = c
l.u = a
b.o = l
b.v = a
b.x = a
b.y = c
a.u = f
a.o = c
a.v = c
a.q = l
a.r = l
a.z = b
a.s = b
m.p = h
h.v = f
f.p = b
f.z = h
c.v = a
c.z = b
assert f.p.y.v.z.o.txt == "l"