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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: G = None
        self.x: B = None
        self.txt = txt

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

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

l.s = j
i.s = c
i.w = k
i.r = k
i.y = e
n.t = k
e.s = n
e.r = l
e.x = j
c.o = l
c.y = d
j.r = d
j.x = i
d.p = k
k.s = c
k.w = i
k.r = i
k.y = e
assert i.r.s.y.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: A = None
        self.y: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.r: G = None
        self.x: B = None
        self.txt = txt

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

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

l.s = j
i.s = c
i.w = k
i.r = k
i.y = e
n.t = k
e.s = n
e.r = l
e.x = j
c.o = l
c.y = d
j.r = d
j.x = i
d.p = k
k.s = c
k.w = i
k.r = i
k.y = e
assert i.r.s.y.p.txt == "k"