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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: C = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: D = None
        self.y: C = None
        self.txt = txt

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

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

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

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

c.o = b
c.s = g
c.v = g
c.w = i
f.r = g
b.z = a
b.o = a
b.u = c
l.z = g
l.y = b
a.u = h
a.r = b
d.v = a
d.q = i
d.x = i
i.q = g
g.z = h
g.y = b
h.z = g
h.y = b
assert l.y.u.v.z.z.txt == "g"