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

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

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.r: F = None
        self.x: B = None
        self.w: A = None
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: G = None
        self.s: E = None
        self.w: F = None
        self.z: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

l.w = h
l.t = k
l.r = c
k.o = n
c.v = j
c.r = h
c.x = k
c.w = l
c.t = l
b.r = n
b.s = g
b.z = g
b.w = h
g.r = l
h.r = n
n.x = l
j.r = n
assert n.x.r.t.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.w: F = None
        self.t: B = None
        self.r: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: F = None
        self.r: F = None
        self.x: B = None
        self.w: A = None
        self.t: A = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.r: G = None
        self.s: E = None
        self.w: F = None
        self.z: E = None
        self.txt = txt

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

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

class G:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

l.w = h
l.t = k
l.r = c
k.o = n
c.v = j
c.r = h
c.x = k
c.w = l
c.t = l
b.r = n
b.s = g
b.z = g
b.w = h
g.r = l
h.r = n
n.x = l
j.r = n
assert n.x.r.t.r.r.txt == "h"