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

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: G = None
        self.v: B = None
        self.x: A = None
        self.r: D = None
        self.txt = txt

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

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

e.w = d
e.p = f
j.w = k
a.u = j
i.u = k
k.r = i
f.p = e
f.x = e
f.y = d
f.v = j
f.r = i
d.z = i
d.w = i
d.x = c
c.u = j
assert i.u.r.u.txt == "
class A:
    def __init__(self, txt: str):
        self.w: G = None
        self.p: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: G = None
        self.v: B = None
        self.x: A = None
        self.r: D = None
        self.txt = txt

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

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

e.w = d
e.p = f
j.w = k
a.u = j
i.u = k
k.r = i
f.p = e
f.x = e
f.y = d
f.v = j
f.r = i
d.z = i
d.w = i
d.x = c
c.u = j
assert i.u.r.u.txt == "k"