class A:
    def __init__(self, txt: str):
        self.v: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: A = None
        self.r: F = None
        self.p: G = None
        self.s: F = None
        self.y: F = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.w: F = None
        self.o: A = None
        self.r: F = None
        self.p: G = None
        self.s: F = None
        self.y: F = None
        self.u: F = None
        self.txt = txt

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

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

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

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

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

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

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