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

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.u: E = None
        self.txt = txt

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

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

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

g = A("g")
m = B("m")
l = C("l")
a = D("a")
h = E("h")
d = F("d")
n = G("n")
c = F("c")

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

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

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

class D:
    def __init__(self, txt: str):
        self.q: A = None
        self.u: E = None
        self.txt = txt

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

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

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

g = A("g")
m = B("m")
l = C("l")
a = D("a")
h = E("h")
d = F("d")
n = G("n")
c = F("c")

g.v = l
m.s = d
l.p = h
l.z = h
l.o = h
a.q = g
a.u = h
h.r = l
d.v = m
d.x = m
d.u = a
d.q = c
d.z = g
d.s = g
d.o = g
n.p = d
n.x = c
c.v = m
c.x = m
c.u = a
c.q = d
c.z = g
c.s = g
c.o = g
assert d.x.s.u.txt == "a"