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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: E = None
        self.x: F = None
        self.y: D = None
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.t: G = None
        self.q: D = None
        self.r: F = None
        self.s: G = None
        self.z: E = None
        self.o: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.w: G = None
        self.txt = txt

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.r: E = None
        self.t: E = None
        self.x: F = None
        self.y: D = None
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.y: E = None
        self.t: G = None
        self.q: D = None
        self.r: F = None
        self.s: G = None
        self.z: E = None
        self.o: F = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.t: A = None
        self.w: G = None
        self.txt = txt

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

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

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

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