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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: A = None
        self.s: E = None
        self.r: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.u: C = None
        self.s: A = None
        self.r: B = None
        self.txt = txt

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

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

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

m.u = a
l.u = b
l.t = m
l.s = c
l.r = k
a.x = b
a.v = f
a.s = f
a.t = c
a.u = m
b.t = f
b.r = f
b.o = c
b.y = c
c.x = k
c.u = a
c.s = m
c.r = l
f.p = k
f.v = k
k.w = b
k.o = b
k.y = f
assert k.y.v.y.v.y.v.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: A = None
        self.s: E = None
        self.r: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.x: G = None
        self.u: C = None
        self.s: A = None
        self.r: B = None
        self.txt = txt

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

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

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

m.u = a
l.u = b
l.t = m
l.s = c
l.r = k
a.x = b
a.v = f
a.s = f
a.t = c
a.u = m
b.t = f
b.r = f
b.o = c
b.y = c
c.x = k
c.u = a
c.s = m
c.r = l
f.p = k
f.v = k
k.w = b
k.o = b
k.y = f
assert k.y.v.y.v.y.v.y.txt == "f"