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

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: F = None
        self.z: F = None
        self.r: B = None
        self.p: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: A = None
        self.txt = txt

a = A("a")
g = B("g")
j = C("j")
m = D("m")
k = E("k")
h = F("h")
l = C("l")
f = D("f")

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

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.q: F = None
        self.z: F = None
        self.r: B = None
        self.p: B = None
        self.txt = txt

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

class F:
    def __init__(self, txt: str):
        self.v: B = None
        self.w: A = None
        self.txt = txt

a = A("a")
g = B("g")
j = C("j")
m = D("m")
k = E("k")
h = F("h")
l = C("l")
f = D("f")

a.s = h
a.u = l
g.p = l
j.o = a
j.r = a
j.u = a
j.t = a
j.q = f
j.x = h
m.y = g
m.r = g
m.p = g
m.q = h
m.z = h
k.o = a
h.v = g
h.w = a
l.o = a
l.r = a
l.u = a
l.t = a
l.q = f
l.x = h
f.y = g
f.r = g
f.p = g
f.q = h
f.z = h
assert j.x.v.p.q.q.txt == "h"