class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: C = None
        self.q: B = None
        self.y: D = None
        self.w: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: D = None
        self.q: C = None
        self.txt = txt

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

k.x = f
k.r = f
k.q = c
k.w = c
k.y = j
c.s = f
c.y = k
f.o = m
f.p = m
j.o = c
j.p = a
j.q = k
i.u = m
a.o = m
m.w = j
m.v = j
m.q = f
assert j.p.o.q.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.x: C = None
        self.r: C = None
        self.q: B = None
        self.y: D = None
        self.w: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.u: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: G = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.w: D = None
        self.v: D = None
        self.q: C = None
        self.txt = txt

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

k.x = f
k.r = f
k.q = c
k.w = c
k.y = j
c.s = f
c.y = k
f.o = m
f.p = m
j.o = c
j.p = a
j.q = k
i.u = m
a.o = m
m.w = j
m.v = j
m.q = f
assert j.p.o.q.o.q.txt == "f"