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

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.u: F = None
        self.o: B = None
        self.x: E = None
        self.txt = txt

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

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

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

l.s = k
l.p = g
l.r = g
j.r = g
b.q = k
b.s = i
g.y = k
g.u = k
g.o = j
g.x = i
i.q = l
k.t = l
assert l.r.o.r.u.t.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.p: D = None
        self.r: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.y: F = None
        self.u: F = None
        self.o: B = None
        self.x: E = None
        self.txt = txt

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

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

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

l.s = k
l.p = g
l.r = g
j.r = g
b.q = k
b.s = i
g.y = k
g.u = k
g.o = j
g.x = i
i.q = l
k.t = l
assert l.r.o.r.u.t.s.txt == "k"