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

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

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

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

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

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

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

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

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

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

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

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

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

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

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