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

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: B = None
        self.p: E = None
        self.t: G = None
        self.s: G = None
        self.x: C = None
        self.txt = txt

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

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

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

g = A("g")
k = B("k")
h = C("h")
l = D("l")
n = E("n")
b = F("b")
c = G("c")

g.p = n
k.t = h
k.o = b
h.o = l
h.v = g
l.o = h
l.x = h
l.y = k
l.p = n
l.t = c
l.s = c
n.u = h
n.v = g
n.w = k
n.q = b
n.o = c
b.t = l
c.r = b
c.z = h
c.w = h
c.v = k
assert l.x.o.x.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: C = None
        self.y: B = None
        self.p: E = None
        self.t: G = None
        self.s: G = None
        self.x: C = None
        self.txt = txt

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

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

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

g = A("g")
k = B("k")
h = C("h")
l = D("l")
n = E("n")
b = F("b")
c = G("c")

g.p = n
k.t = h
k.o = b
h.o = l
h.v = g
l.o = h
l.x = h
l.y = k
l.p = n
l.t = c
l.s = c
n.u = h
n.v = g
n.w = k
n.q = b
n.o = c
b.t = l
c.r = b
c.z = h
c.w = h
c.v = k
assert l.x.o.x.v.txt == "g"