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

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

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

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

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

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

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

h.z = k
h.r = l
k.y = h
k.s = i
g.o = k
l.u = h
l.p = k
l.x = k
l.q = i
i.o = h
f.v = g
f.w = h
f.p = i
assert l.u.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.z: B = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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

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

h.z = k
h.r = l
k.y = h
k.s = i
g.o = k
l.u = h
l.p = k
l.x = k
l.q = i
i.o = h
f.v = g
f.w = h
f.p = i
assert l.u.r.q.txt == "i"