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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: C = None
        self.x: D = None
        self.r: D = None
        self.z: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: D = None
        self.o: G = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.s: B = None
        self.o: G = None
        self.y: D = None
        self.txt = txt

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

f = A("f")
k = B("k")
e = C("e")
a = D("a")
b = E("b")
i = F("i")
j = G("j")

f.y = k
f.r = k
f.q = j
k.w = b
k.z = b
k.s = e
k.x = a
k.r = a
e.z = i
a.u = i
a.w = k
b.w = a
b.q = a
b.o = j
b.r = k
i.q = f
i.s = k
i.o = j
i.y = a
j.t = i
j.x = a
assert j.x.u.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.r: B = None
        self.q: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.s: C = None
        self.x: D = None
        self.r: D = None
        self.z: E = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: D = None
        self.q: D = None
        self.o: G = None
        self.r: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.q: A = None
        self.s: B = None
        self.o: G = None
        self.y: D = None
        self.txt = txt

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

f = A("f")
k = B("k")
e = C("e")
a = D("a")
b = E("b")
i = F("i")
j = G("j")

f.y = k
f.r = k
f.q = j
k.w = b
k.z = b
k.s = e
k.x = a
k.r = a
e.z = i
a.u = i
a.w = k
b.w = a
b.q = a
b.o = j
b.r = k
i.q = f
i.s = k
i.o = j
i.y = a
j.t = i
j.x = a
assert j.x.u.q.r.txt == "k"