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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: E = None
        self.txt = txt

l = A("l")
h = B("h")
g = C("g")
n = D("n")
i = E("i")
f = F("f")

l.q = i
l.r = n
h.t = i
g.s = i
g.u = i
g.w = l
g.p = n
g.v = n
n.t = f
n.w = i
i.o = h
f.w = h
f.p = i
assert i.o.t.o.t.o.t.txt == "
class A:
    def __init__(self, txt: str):
        self.q: E = None
        self.r: D = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: B = None
        self.p: E = None
        self.txt = txt

l = A("l")
h = B("h")
g = C("g")
n = D("n")
i = E("i")
f = F("f")

l.q = i
l.r = n
h.t = i
g.s = i
g.u = i
g.w = l
g.p = n
g.v = n
n.t = f
n.w = i
i.o = h
f.w = h
f.p = i
assert i.o.t.o.t.o.t.txt == "i"