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

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

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

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

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

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

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

b = A("b")
c = B("c")
l = C("l")
d = D("d")
n = E("n")
f = F("f")
e = G("e")
g = G("g")
j = E("j")

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

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

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

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

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

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

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

b = A("b")
c = B("c")
l = C("l")
d = D("d")
n = E("n")
f = F("f")
e = G("e")
g = G("g")
j = E("j")

b.s = f
b.u = g
c.z = d
c.s = f
l.r = c
d.w = l
d.u = l
d.x = f
d.o = f
d.q = b
n.p = c
f.z = d
f.u = b
e.t = b
e.r = b
g.t = b
g.r = b
j.p = c
assert n.p.z.q.s.z.o.txt == "f"