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

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

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

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

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

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

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

l = A("l")
i = B("i")
j = C("j")
g = D("g")
b = E("b")
h = F("h")
e = G("e")
k = B("k")

l.t = j
l.s = g
i.p = l
i.u = l
i.o = b
i.q = k
j.u = b
g.r = h
b.s = e
h.s = j
h.v = k
e.u = j
e.w = l
k.p = l
k.u = l
k.o = b
k.q = i
assert k.u.s.r.v.u.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.s: D = None
        self.txt = txt

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

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

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

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

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

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

l = A("l")
i = B("i")
j = C("j")
g = D("g")
b = E("b")
h = F("h")
e = G("e")
k = B("k")

l.t = j
l.s = g
i.p = l
i.u = l
i.o = b
i.q = k
j.u = b
g.r = h
b.s = e
h.s = j
h.v = k
e.u = j
e.w = l
k.p = l
k.u = l
k.o = b
k.q = i
assert k.u.s.r.v.u.t.txt == "j"