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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: B = None
        self.t: F = None
        self.s: C = None
        self.v: F = None
        self.y: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.x: C = None
        self.r: E = None
        self.y: D = None
        self.p: C = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: B = None
        self.t: F = None
        self.s: C = None
        self.v: F = None
        self.y: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: E = None
        self.x: C = None
        self.r: E = None
        self.y: D = None
        self.p: C = None
        self.txt = txt

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

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

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