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

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

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

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

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

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

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

a = A("a")
m = B("m")
b = C("b")
h = D("h")
c = E("c")
n = F("n")
j = G("j")
f = F("f")
k = G("k")

a.s = k
m.u = a
m.r = b
m.t = h
m.x = h
b.o = h
b.s = m
b.y = m
b.z = c
h.v = f
c.t = b
c.z = b
c.u = b
n.t = h
n.p = f
n.w = f
n.s = f
j.t = h
j.x = f
j.o = m
j.u = n
f.t = h
f.p = n
f.w = n
f.s = n
k.t = h
k.x = n
k.u = n
k.o = m
assert k.x.s.p.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: G = None
        self.txt = txt

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

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

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

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

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

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

a = A("a")
m = B("m")
b = C("b")
h = D("h")
c = E("c")
n = F("n")
j = G("j")
f = F("f")
k = G("k")

a.s = k
m.u = a
m.r = b
m.t = h
m.x = h
b.o = h
b.s = m
b.y = m
b.z = c
h.v = f
c.t = b
c.z = b
c.u = b
n.t = h
n.p = f
n.w = f
n.s = f
j.t = h
j.x = f
j.o = m
j.u = n
f.t = h
f.p = n
f.w = n
f.s = n
k.t = h
k.x = n
k.u = n
k.o = m
assert k.x.s.p.p.txt == "f"