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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: B = None
        self.x: E = None
        self.u: C = None
        self.w: B = None
        self.p: E = None
        self.r: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.x: F = None
        self.u: C = None
        self.q: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: A = None
        self.s: D = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.o: B = None
        self.v: B = None
        self.x: E = None
        self.u: C = None
        self.w: B = None
        self.p: E = None
        self.r: G = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.t: F = None
        self.x: F = None
        self.u: C = None
        self.q: B = None
        self.txt = txt

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

class G:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: A = None
        self.s: D = None
        self.txt = txt

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

g.r = h
g.t = d
g.q = b
a.t = b
a.o = l
h.x = b
h.t = b
h.y = a
b.o = a
b.v = a
b.w = a
b.x = e
b.p = e
b.u = h
b.r = d
e.t = l
e.x = l
e.u = h
e.q = a
l.t = d
d.r = b
d.s = b
d.p = g
assert l.t.s.u.txt == "h"